/*
 * Copyright (C) 2018 Zhejiang xiaominfo Technology CO.,LTD.
 * All rights reserved.
 * Official Web Site: http://www.xiaominfo.com.
 * Developer Web Site: http://open.xiaominfo.com.
 */

package cn.edu.nwafu.nic.nucleic_acid_test.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

/**
 * @author: SungLee
 * @date: 2022-02-19 19:21
 * @description: knife4j的配置
 */
@Configuration
@EnableSwagger2WebMvc
public class Knife4jConfiguration {

    @Bean(value = "defaultApi2")
    public Docket defaultApi2() {
        Contact contact = new Contact("李嵩", "暂不开放", "sunglee@nwafu.edu.cn");
        Docket docket = new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("西北农林科技大学第二次全员核酸检测数据统计API文档")
                        .description("西北农林科技大学第二次全员核酸检测数据统计API文档")
                        //.termsOfServiceUrl("http://www.xx.com/")
                        .contact(contact)
                        .version("1.0.1")
                        .build())
                //分组名称
                .groupName("V1版本")
                .select()
                //这里指定Controller扫描包路径
                .apis(RequestHandlerSelectors.basePackage("cn.edu.nwafu.nic.nucleic_acid_test.controller"))
                .paths(PathSelectors.any())
                .build();
        return docket;
    }
}
